"""
首页
"""
from selenium.webdriver.common.by import By

from page_objects.base_page import BasePage
from utils.log_util import logger


class HomePage(BasePage):
    __MENU_MALL_MANAGE = (By.XPATH, '//*[@id="app"]/div/div[1]/div[1]/div/ul/div[3]/li/div')
    __MENU_PRODUCT_CATEGORY = (By.XPATH, '//*[@id="app"]/div/div[1]/div[1]/div/ul/div[3]/li/ul/div[1]/a/li')

    def go_to_category(self):
        logger.info("进入商品列表")
        self.do_find(self.__MENU_MALL_MANAGE).click()
        self.do_find(self.__MENU_PRODUCT_CATEGORY).click()

        from page_objects.category_list_page import CategoryListPage
        return CategoryListPage(self.driver)
